package com.itfreer.data.dbregist;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import org.springframework.beans.BeanUtils;

import com.itfreer.data.db.entity.DBRegistEntity;

@Entity(name = "data_dbregist")
@Table(indexes = {})
public class JdbcDBRegistEntity implements Serializable {

	private static final long serialVersionUID = -8443497714033818376L;
	
	/**
	 * id值，主键，唯一值 系统应用中必需关联此值
	 */
	@Id
	@Column(name = "id", length = 50, nullable = false)
	private String id;
	
	/**
	 * 作为子表时的外键
	 */
	@Column(name = "f_key", nullable = true)
	private String fKey;
	
	/**
	 * 数据库类型
	 */
	@Column(name = "s_dbtype", nullable = true)
	private String dbType;
	/***
	 * 数据库ip地址
	 */
	@Column(name = "s_dbip", nullable = true)
	private String dbIp;
	/***
	 * 数据库端口号
	 */
	@Column(name = "s_dbport", nullable = true)
	private String dbPort;
	/***
	 * 数据库实例名
	 */
	@Column(name = "s_dbname", nullable = true)
	private String dbName;
	/**
	 * 用户名
	 */
	@Column(name = "s_username", nullable = true)
	private String userName;
	/***
	 * 用户密码
	 */
	@Column(name = "s_password", nullable = true)
	private String passWord;
	/***
	 * 连接connectUrl
	 */
	@Column(name = "s_connecturl", nullable = true)
	private String connectUrl;
	/***
	 * dialect 方言
	 */
	@Column(name = "s_dialect", nullable = true)
	private String dialect;
	/***
	 * 驱动类
	 */
	@Column(name = "s_driverclass", nullable = true)
	private String driverClass;
	/***
	 * 显示sql
	 */
	@Column(name = "s_showsql", nullable = true)
	private String showSql;
	/***
	 * 格式化sql
	 */
	@Column(name = "s_formatsql", nullable = true)
	private String formatSql;
	
	/**
	 * 数据库查询字段
	 */
	@Column(name = "s_qfvalue", length = 500, nullable = true)
	private String qfValue; 
	/***
	 * 表名
	 */
	@Column(name = "s_tablename", nullable = true)
	private String tableName;
	/***
	 * 表默认过滤条件
	 */
	@Column(name = "s_dfwhere", nullable = true)
	private String dfWhere;
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}
	
	public String getDbType() {
		return dbType;
	}

	public void setDbType(String dbType) {
		this.dbType = dbType;
	}

	public String getDbIp() {
		return dbIp;
	}

	public void setDbIp(String dbIp) {
		this.dbIp = dbIp;
	}

	public String getDbPort() {
		return dbPort;
	}

	public void setDbPort(String dbPort) {
		this.dbPort = dbPort;
	}

	public String getDbName() {
		return dbName;
	}

	public void setDbName(String dbName) {
		this.dbName = dbName;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassWord() {
		return passWord;
	}

	public void setPassWord(String passWord) {
		this.passWord = passWord;
	}

	public String getConnectUrl() {
		return connectUrl;
	}

	public void setConnectUrl(String connectUrl) {
		this.connectUrl = connectUrl;
	}

	public String getDialect() {
		return dialect;
	}

	public void setDialect(String dialect) {
		this.dialect = dialect;
	}

	public String getDriverClass() {
		return driverClass;
	}

	public void setDriverClass(String driverClass) {
		this.driverClass = driverClass;
	}

	public String getShowSql() {
		return showSql;
	}

	public void setShowSql(String showSql) {
		this.showSql = showSql;
	}

	public String getFormatSql() {
		return formatSql;
	}

	public void setFormatSql(String formatSql) {
		this.formatSql = formatSql;
	}

	public String getDfWhere() {
		return dfWhere;
	}

	public void setDfWhere(String dfWhere) {
		this.dfWhere = dfWhere;
	}
	
	public String getTableName() {
		return tableName;
	}

	public void setTableName(String tableName) {
		this.tableName = tableName;
	}

	public String getfKey() {
		return fKey;
	}

	public void setfKey(String fKey) {
		this.fKey = fKey;
	}

	public String getQfValue() {
		return qfValue;
	}

	public void setQfValue(String qfValue) {
		this.qfValue = qfValue;
	}

	public void from(DBRegistEntity t) {
		BeanUtils.copyProperties(t, this);
	}
	
	public DBRegistEntity toEntity() {
		DBRegistEntity toEntity = new DBRegistEntity();
		BeanUtils.copyProperties(this, toEntity);
		return toEntity;
	}
}
